package com.ddone.demo.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @author ddone
 * @date 2024/3/23-15:19
 * 拦截器测试
 */
@Controller
@RequestMapping("/interceptor")
public class InterceptorController {

    /**
     * 测试敏感词拦截
     * @param model
     * @return
     */
    // http://localhost:8080/spring-mvc-demo/interceptor/test1
    @GetMapping("/test1")
    public String test(Model model){
        model.addAttribute("message", "我有敏感词, 哈哈哈");
        return "index";
    }

    // http://localhost:8080/spring-mvc-demo/interceptor/test2
    @GetMapping("/test2")
    public String test2(Model model){
        model.addAttribute("message", "你是敏感词, 哈哈哈");
        return "index";
    }

    @GetMapping("/test3")
    public String test3(Model model){
        return "index";
    }
}
